#include <stdio.h>
#include <stdlib.h>

// 数据结构：Trie树

typedef struct node{
    char value;
    struct node *next[10];
    int count;
}node;
node *top;
int count = 0;
char tel[8];

void getOneTel();
int convert(int);
void printDup(int, node *);

int main(int argc, const char * argv[]) {
    int n = 0;
    int i;
    char ch;
    
    top = (node *) malloc(sizeof(node));
    for (i = 0; i < 10; i++) {
        top->next[i] = NULL;
    }
    
    while ((ch=getchar()) != '\n') {
        n = n * 10 + ch - '0';
    }
    while (n--) {
        getOneTel();
    }
    printDup(0, top);
    if (count == 0) {
        printf("No duplicates.\n");
    }
    
    return 0;
}

void getOneTel()
{
    node *now;
    int ch, i;
    
    now = top;
    do {
        ch = getchar();
        if (ch == '\n' || ch == EOF) {
            break;
        } else if (ch == '-') {
            continue;
        } else {
            ch = convert(ch);
            if (now->next[ch] != NULL) {
                now = now->next[ch];
                now->count++;
            } else {
                now->next[ch] = (node *) malloc(sizeof(node));
                now = now->next[ch];
                now->value = ch+'0';
                for (i = 0; i < 10; i++) {
                    now->next[i] = NULL;
                }
                now->count = 1;
            }
        }
    } while (1);
}

void printDup(int d, node *p) {
    int i;
    
    if (d == 7) {
        if (p->count > 1) {
            count++;
            tel[d] = p->value;
            for (i = 1; i <= 3; i++) {
                putchar(tel[i]);
            }
            putchar('-');
            for (i = 4; i <= 7; i++) {
                putchar(tel[i]);
            }
            printf(" %d\n", p->count);
        }
    } else {
        tel[d] = p->value;
        for (i = 0; i <= 9; i++) {
            if (p->next[i] != NULL) {
                printDup(d+1, p->next[i]);
            }
        }
    }
}

int convert(int ch)
{
    if (ch >= '0' && ch <= '9') {
        return ch - '0';
    }
    if (ch == 'A' || ch == 'B' || ch == 'C')
        return 2;
    if (ch == 'D' || ch == 'E' || ch == 'F')
        return 3;
    if (ch == 'G' || ch == 'H' || ch == 'I')
        return 4;
    if (ch == 'J' || ch == 'K' || ch == 'L')
        return 5;
    if (ch == 'M' || ch == 'N' || ch == 'O')
        return 6;
    if (ch == 'P' || ch == 'R' || ch == 'S')
        return 7;
    if (ch == 'T' || ch == 'U' || ch == 'V')
        return 8;
    return 9;
}